<?php echo $html->link(__('Create new ad'),'/admin/ads/add',array('class'=>'add_button'));?>
<?php echo $html->link(__('Edit Zone'),'/admin/ads/editZone',array('class'=>'add_button'));?>
<?php
$index->setData($adsData,'Ad');
$index->setPaginateSeparator(' ');
$index->showFields(array('id', 'title','zone','created'));
$index->sortableFields(array('id','title','created','zone'));
$index->setAction('View','/admin/ads/view/:Ad.id');
$index->setAction('Random View','/admin/ads/random_view/:Ad.zone');
$index->setAction('Edit','/admin/ads/edit/:Ad.id');
$index->setAction('Delete','/admin/ads/delete/:Ad.id',$this->helpers,__('Are you sure you want to delete this ad ?'));
$index->setAction(null,null,$this->helpers,false,true,'setStatus');
function setStatus($model,$adsData)
{
	if($adsData[$model]['published']==0)
	{
		$statusLink['title'] = __('Publish');
		$statusLink['url'] = '/admin/ads/publish/'.$adsData[$model]['id'];
	}
	else
	{
		
		$statusLink['title'] = __('Unpublish');
		$statusLink['url'] = '/admin/ads/unpublish/'.$adsData[$model]['id'];
	}
	return $statusLink;


}

echo $index->display($adsData);
?>
